package crtl;
/**
 *
 * @author meraner marcel
 */
public enum Direction {

	FORWARD(0, -1),
	RIGHT(90, -1),
	LEFT(270, -1),
	
	S_FRONT_RIGHT(15, 0),
	S_FORWARD_RIGHT(45, 1),
	S_RIGHT(90, 2),
	S_REAR_RIGHT(160, 3),
	S_REAR_LEFT(200, 4),
	S_LEFT(270, 5),
	S_FORWARD_LEFT(315, 6),
	S_FRONT_LEFT(345, 7);

	private final double _angle;
	private final int _index;

	Direction(double angle, int index) {
		_angle = angle;
		_index = index;
		
	}

	public double getAngle() {
		return _angle;
	}
	
	public int getIndex() {
		return _index;
	}
	
	public static Direction getByIndex(int index) {
		for (Direction d : Direction.values()) {
			if (d.getIndex() == index) {
				return d;
			}
		}
		return null;
	}
}
